package cn.seaboot.flake.where;

import cn.seaboot.commons.core.FastJsonUtils;
import cn.seaboot.commons.lang.Warning;

/**
 * 查询条件
 */
public class WhereCondition implements Cloneable {
    /**
     * 表名
     */
    private String tableName;
    /**
     * 列名
     */
    private String columnName;
    /**
     * 字段值
     */
    private String value;
    /**
     * 比较规则
     */
    private Logical logical;
    /**
     * 字段类型
     */
    private Class<?> javaType;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Logical getLogical() {
        return logical;
    }

    public void setLogical(Logical logical) {
        this.logical = logical;
    }

    public Class<?> getJavaType() {
        return javaType;
    }

    public void setJavaType(Class<?> javaType) {
        this.javaType = javaType;
    }

    @Override
    public String toString() {
        return FastJsonUtils.toJSONString(this);
    }

    /**
     * 特殊
     * @return
     */
    @Override
    @SuppressWarnings(Warning.ALL)
    public WhereCondition clone() {
        WhereCondition ret = new WhereCondition();
        ret.setTableName(tableName);
        ret.setColumnName(columnName);
        ret.setValue(value);
        ret.setLogical(logical);
        ret.setJavaType(javaType);
        return ret;
    }
}
